﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TXTD.Admin.Data.Migrations
{
    public partial class _202206182 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Log4Net",
                table: "Log4Net");

            migrationBuilder.DropColumn(
                name: "Date",
                table: "Log4Net");

            migrationBuilder.EnsureSchema(
                name: "TXTD");

            migrationBuilder.RenameTable(
                name: "Log4Net",
                newName: "LOG4_NET",
                newSchema: "TXTD");

            migrationBuilder.RenameColumn(
                name: "Thread",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "THREAD");

            migrationBuilder.RenameColumn(
                name: "Message",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "MESSAGE");

            migrationBuilder.RenameColumn(
                name: "Logger",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "LOGGER");

            migrationBuilder.RenameColumn(
                name: "Level",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "LEVEL");

            migrationBuilder.RenameColumn(
                name: "Exception",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "EXCEPTION");

            migrationBuilder.RenameColumn(
                name: "Id",
                schema: "TXTD",
                table: "LOG4_NET",
                newName: "ID");

            migrationBuilder.AddColumn<string>(
                name: "CREATED_BY",
                schema: "TXTD",
                table: "LOG4_NET",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<DateTime>(
                name: "CREATED_TIME",
                schema: "TXTD",
                table: "LOG4_NET",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "UPDATED_BY",
                schema: "TXTD",
                table: "LOG4_NET",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<DateTime>(
                name: "UPDATED_TIME",
                schema: "TXTD",
                table: "LOG4_NET",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddPrimaryKey(
                name: "PK_LOG4_NET",
                schema: "TXTD",
                table: "LOG4_NET",
                column: "ID");

            migrationBuilder.CreateTable(
                name: "SYS_USER",
                schema: "TXTD",
                columns: table => new
                {
                    USER_ID = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    USER_CODE = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    USER_NAME = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
                    REAL_NAME = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
                    EMAIL_ADDRESS = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    MOBILE_NUMBER = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: true),
                    PASSWORD_KEY = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    PASSWORD = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    LAST_LOGIN_TIME = table.Column<DateTime>(type: "datetime2", nullable: false),
                    CREATED_BY = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CREATED_TIME = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UPDATED_BY = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SYS_USER", x => x.USER_ID);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SYS_USER",
                schema: "TXTD");

            migrationBuilder.DropPrimaryKey(
                name: "PK_LOG4_NET",
                schema: "TXTD",
                table: "LOG4_NET");

            migrationBuilder.DropColumn(
                name: "CREATED_BY",
                schema: "TXTD",
                table: "LOG4_NET");

            migrationBuilder.DropColumn(
                name: "CREATED_TIME",
                schema: "TXTD",
                table: "LOG4_NET");

            migrationBuilder.DropColumn(
                name: "UPDATED_BY",
                schema: "TXTD",
                table: "LOG4_NET");

            migrationBuilder.DropColumn(
                name: "UPDATED_TIME",
                schema: "TXTD",
                table: "LOG4_NET");

            migrationBuilder.RenameTable(
                name: "LOG4_NET",
                schema: "TXTD",
                newName: "Log4Net");

            migrationBuilder.RenameColumn(
                name: "THREAD",
                table: "Log4Net",
                newName: "Thread");

            migrationBuilder.RenameColumn(
                name: "MESSAGE",
                table: "Log4Net",
                newName: "Message");

            migrationBuilder.RenameColumn(
                name: "LOGGER",
                table: "Log4Net",
                newName: "Logger");

            migrationBuilder.RenameColumn(
                name: "LEVEL",
                table: "Log4Net",
                newName: "Level");

            migrationBuilder.RenameColumn(
                name: "EXCEPTION",
                table: "Log4Net",
                newName: "Exception");

            migrationBuilder.RenameColumn(
                name: "ID",
                table: "Log4Net",
                newName: "Id");

            migrationBuilder.AddColumn<DateTime>(
                name: "Date",
                table: "Log4Net",
                type: "datetime",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddPrimaryKey(
                name: "PK_Log4Net",
                table: "Log4Net",
                column: "Id");
        }
    }
}
